package com.sgb.kjwl.view.ui.activity.transport;

import android.content.Context;
import android.content.Intent;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.GridLayoutManager;

import com.sgb.kjwl.AppActivity;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.ActivityGoodsInfoOrderSuccess3Binding;
import com.sgb.kjwl.di.transport.DaggerTransportComponent;
import com.sgb.kjwl.di.transport.TransportModule;
import com.sgb.kjwl.model.entity.transport.GoodsInfoEntity3;
import com.sgb.kjwl.view.ui.adapter.transport.GoodsInfoOrderSuccessAdapter3;
import com.sgb.kjwl.viewmodel.transport.GoodsInfoOrderSuccessModel3;
import com.swgk.core.base.di.AppComponent;

import java.util.List;

import javax.inject.Inject;

public class GoodsInfoOrderSuccessActivity3 extends AppActivity {

    private ActivityGoodsInfoOrderSuccess3Binding binding;
    private GoodsInfoOrderSuccessAdapter3 adapter;

    @Inject
    GoodsInfoOrderSuccessModel3 model;

    public static void start(Context context){
        Intent intent = new Intent(context,GoodsInfoOrderSuccessActivity3.class);
        context.startActivity(intent);
    }

    @Override
    protected void setupActivityComponent(AppComponent appComponent) {
        DaggerTransportComponent.builder().appComponent(appComponent).transportModule(new TransportModule(this)).build().inject(this);
    }

    @Override
    protected void initView() {
        binding = DataBindingUtil.setContentView(this, R.layout.activity_goods_info_order_success3);
        binding.include.ivBack.setOnClickListener(view -> finish());
        binding.include.titleView.setText("承运商机");

        adapter = new GoodsInfoOrderSuccessAdapter3(this,null);
        binding.goodsInfoOrderSuccess.setLayoutManager(new GridLayoutManager(this,1));
        binding.goodsInfoOrderSuccess.setAdapter(adapter);
    }

    @Override
    protected void init() {
        model.getOrderSuccessList();
    }

    public void getOrderSuccessList(List<GoodsInfoEntity3> list){
        adapter.setDatas(list);
    }
}
